<?php

require_once 'class/admin.php';
//require_once 'class/staff.php';
//require_once 'class/roster.php';
//require_once 'libs/configTest.php';
//require_once 'class/test1.php';;

/*
 * This is the simulation of real steps
 * ---first time initial data------start --------
 * step0:Run DB script to create database "roster_users",
 * step1:Insert(regist)first admin account---filled in table
 * step2:Name roster project by unique name---will create new DB on that name.
 * step3:initial duties array, and roster time range then create individual roster and duty tables
 * step4:initial participanter's by type or inport xml sheel of data into "roster_users" DB
 * step5:user login to initial their favour duties and exception date.
 * step6:system caculate the roster.
 * ------inital data -------end--------
 * ----second time---start-----
 * step7:admin start new roster.
 * step8:users login to fill in their exception date.----option, they could change their prefer duties array
 * step9: admin generate newroster.
 * -----second time---end-----
 * 
 * ------new Admin register--------------
 * 
 */

//step1 start
//$testConfig = new DBconfigTest();

/*
  $GiveName = "Grace";
  $Surname = "Guo";
  $Email = "graceguo2625@gmail.com";
  $PW = sha1("1234");
 * 
 */
/*
  $testConfig->registerAdmin($GiveName, $Surname, $Email, $PW);//1
  //step1 end
  //step1 testing
 * 
 */


//step2 start
/*
  $newDBName = 'NewDB'; // get from the admin interface;
  $testConfig->initalDB($newDBName);//3
  echo '----------crateDB------------<br>';
  $adminTesting->updateRosterDBToUserDB($newDBName);//4
  echo '------------updateDBName----------<br>';


  //step2 end

  //step3 start

  $tempDutiesArray = array(
  'reading','writing','speaking','listerning','testing'
  );
 */
/*
  $tempStartDate = '2014/02/01';
  $tempEndDate = '2015/03/24';

  $roster = new roster();
  $roster->setStarEndDate($tempStartDate, $tempEndDate);
  $roster->ShowSundayArray();
  //$adminTesting->initialRosterTable($tempDutiesArray, $tempStartDate, $tempEndDate);
  //echo "-----------create the roster and duty tables in new DB";


  //step 3 end
  //$admin->initalRoster();
  //$admin->getSundayArray();

  /*
  $staff1 = new staff('Grace', '1234');

 * 
 */
//$admin->setRosterDutiesArray($tempDutiesArray);
//$admin->getRosterDutiesArray();
//$admin->showRosterDutiesArray();
//echo '------------------------------------------------------';
//$admin->showRosterDutiesArray();

/*

  $tempWillingArray = array('reading','listerning');
  $staff1->setWillingArray($tempWillingArray);
  $staff1->showWillingArray();

  $tempUnableArray = array('2013/02/17','2013/02/24');
  $staff1->setUnableArray($tempUnableArray);
  $staff1->showUnableArray();
  echo '=------------------';
  $admin->firstTimeCreateRosterDB();
 * /
 */

//$admin->caculateSundays();
//$admin->checkpw("Mark","12344");
//$test = new test2();
//$test->fn();
//test6-1 admin login and add staff
//$adminTesting = new admin($Email, $PW, $testConfig->getDB()); 
//$adminTesting->createStaffData();
//$adminTesting->addStaff("Mark", "AddStaff1", "xjz@gmail.com");
//test 6-2 admin logout();
//$adminTesting = new admin("test1@", sha1("1234"));
//$dutyarray =$adminTesting->fetchDutyArray();
//$excpArray = $adminTesting->fetchSundayArray();
//echo count($array);
//$DutiesArray=array('day1','day2');
//$ExceptDayArray = array('duty1','duty2');
//$staffTesting->initialStaffData($DutiesArray, $ExceptDayArray);

$admin = new admin("test1@", sha1("1234"));
$result = $admin->RosterWithFullName();

//$temp =$admin->generatRosterArray();
//$admin->echoArray($temp[3][4]);

 /*
$people = array("Peter", "Joe","Cleveland", "Glenn", "Cleveland");
$people[]="add";
echo count($people)."<br>";
echo "<pre>";
print_r($people);

;
echo count(array_unique($people))."<br>";
echo "<pre>";
print_r(array_unique($people));
if(in_array("add", $people)){
    echo 'there';
}else{
    echo "not there";
}


/*
$lineArray = array();
for ($k = 0; $k < 4; $k++) {
    $emptyString = "";
    for ($i = 0; $i < 5; $i++) {
        $emptyString = $emptyString . "<td>" . $testday[$k][$i] . "</td>";   
    }
    echo $emptyString;
    echo "<br>";
    //$lineArray[$k] = $emptyString;
}
echo "<pre>";
//print_r($lineArray[0]);

/*
  $result = $admin->fetchSundayArray();
  echo "<pre>";
  print_r($result);

  $result = $admin->fetchDutyArray();
  echo "<pre>";
  print_r($result);
 * 
 */
/*
  $tempString = "";
  for ($i = 0; $i < count($result); $i++) {
  $tempString = $tempString.$result[$i]['gName'] . "----" . $result[$i]['surname'] . "----" . $result[$i]['email']."<br>";
  }
  echo $tempString;
 * 
 */
//$staff = new staff("admin5@", sha1("1234"));
//$staff->checkInitial();
?>
